---
import AuthorCard from "@/components/AuthorCard.astro";
import Base from "@/layouts/Base.astro";
import { getListPage, getSinglePage } from "@/lib/contentParser.astro";
import PageHeader from "@/partials/PageHeader.astro";

const authorIndex = await getListPage("authors", "-index");

if (authorIndex.data.draft) {
  return Astro.redirect("/404");
}

const authors = await getSinglePage("authors");
---

<Base title={authorIndex.data.title}>
  <PageHeader title={authorIndex.data.title} />
  <section class="section-sm pb-0">
    <div class="container">
      <div class="row justify-center">
        {
          authors.map((author) => (
            <div class="mb-14 md:col-6 lg:col-4">
              <AuthorCard data={author} />
            </div>
          ))
        }
      </div>
    </div>
  </section>
</Base>
